package com.zy.dp.iterator.example4;

import java.util.Iterator;

@SuppressWarnings("rawtypes")
public class ArrayIteratorImpl implements Iterator
{
	private SalaryManager aggregate = null;
	private int index = 0;

	public ArrayIteratorImpl(SalaryManager aggregate)
	{

		this.aggregate = aggregate;
	}

	@Override
	public boolean hasNext()
	{
		if (aggregate != null && index < aggregate.size())
		{
			return true;
		}
		return false;
	}

	@Override
	public Object next()
	{

		Object recObj = null;

		if (hasNext())
		{
			recObj = aggregate.get(index);
			index++;
		}

		return recObj;

	}

	@Override
	public void remove()
	{
		// TODO Auto-generated method stub

	}

}
